package com.gcd.gym.utils;


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class JsonResult<T> {
    private int code;
    private T data;
    private boolean success;
    private String message;

    public static JsonResult<?> success() {
        return success(null);
    }

    public  static <T> JsonResult<T> success(T data) {
        return new JsonResult<>(200,data,true,"操作成功");
    }

    public static JsonResult<?> fail(int code,String message) {
        return new JsonResult<>(code,null,false,message);
    }
    public static JsonResult<?> fail(String message) {
        return fail(4848,message);
    }

}
